<template>
    <el-date-picker
        v-model="selectValue"
        type="date"
        :placeholder="placeholder"
        :format="format"
        :value-format="valueFormat"
    />
</template>

<script lang="ts" setup name="SGDatePicker">
import type { PropType } from 'vue';
import type { IComponentInfoType } from '@/types/component';

const props = defineProps({
    info: {
        required: true,
        type: Object as PropType<IComponentInfoType>,
        default: () => {}
    }
});

const placeholder = computed(() => {
    return props.info.placeholder || `请选择`;
});

const format = computed(() => {
    return props.info.format || `YYYY-MM-DD`;
});

const valueFormat = computed(() => {
    return props.info.valueFormat || `YYYY-MM-DD`;
});

const selectValue = defineModel();
</script>
